﻿using SBlogCore.Common.JWTExtend.Models;
using SBlogCore.Entitys.SysRoleManager;
using SBlogCore.Entitys.SystemManager;
using SBlogCore.WebAdminApplication.SysRoleManager.Dto;

namespace SBlogCore.WebAdminApplication.SysRoleManager.IServices
{
    public  interface ISysRoleManagerService
    {
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task<PageList<SysRoleInfo>> GetList(SysRoleInfoQueryInPut inPut);
        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task Add(SysRoleInfoInPut inPut);
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task Upload(SysRoleInfoUploadInPut inPut);
        /// <summary>
        /// 为角色添加用户
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task UpdateRoleUser(RoleUserInPut inPut);
        /// <summary>
        /// 为角色移除用户
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>

        Task MoveRoleUser(RoleUserInPut inPut);
        /// <summary>
        /// 为用户添加角色
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task UpdateUserRole(UserRoleInPut inPut);
        /// <summary>
        /// 为用户移除角色
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task MoveUserRole(UserRoleInPut inPut);
        /// <summary>
        /// 获取所有拥有该权限的用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<List<SysUserRole>> GetUerListByRole(long id);

        /// <summary>
        /// 通过权限ID获取所有用户，并标识该用户是否拥有该权限
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task<PageList<UserWithRoleOutPut>> GetUserInfoWithRole(UserInfoWithRoleQueryInPut inPut);

        /// <summary>
        /// 通过用户ID获取所有权限，并标识该用户是否拥有某个权限
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns> 
        Task<List<long>> GetRoleWithUser(long userId);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>

        Task Delete(IEnumerable<long> ids);
        /// <summary>
        /// 编码是否已存在
        /// </summary>
        /// <param name="code"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> AnyCode(string code, long? id = null);
        /// <summary>
        /// 获取当前菜单所匹配的角色
        /// </summary>
        /// <param name="menuId"></param>
        /// <returns></returns>

        Task<List<long>> GetRoleWithMenu(long menuId);
        /// <summary>
        /// 为角色添加菜单
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task UpdateRoleWithMenu(RoleMenuInPut inPut);
        /// <summary>
        /// 移除角色所拥有的的菜单
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task MoveRoleWithMenu(RoleMenuInPut inPut);
        /// <summary>
        /// 为角色添加菜单
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task UpdateMenuWithRole(MenuRoleInPut inPut);
        /// <summary>
        /// 移除角色所拥有的的菜单
        /// </summary>
        /// <param name="inPut"></param>
        /// <returns></returns>
        Task MoveMenuWithRole(MenuRoleInPut inPut);
        /// <summary>
        /// 获取当前角色所拥有的菜单权限
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        Task<List<long>> GetMenuWithRole(long roleId);
        /// <summary>
        /// 通过用户ID，获取该用户所拥有的菜单
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Task<List<SysMenu>> GetMenuWithUserRole(TokenModelJwt user);

        /// <summary>
        /// 通过用户ID获取角色集
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<List<SysRoleInfo>?> GetRolesWithUser(long userId);
    }
}
